package com.yuanyu.common.exception;


import com.yuanyu.common.constant.ApiConstant;
import lombok.Getter;
import lombok.Setter;

/**
 * 通用异常类
 */
@Getter
@Setter
public class ParameterException extends RuntimeException {
    private String message;
    private Integer errorCode;

    public ParameterException(){
        super(ApiConstant.ERROR_MESSAGE);
        this.errorCode = ApiConstant.ERROR_CODE;
    }

    public ParameterException(int errorCode){
        super(ApiConstant.ERROR_MESSAGE);
        this.errorCode = errorCode;
    }

    /**
     *
     * @param errorMessage
     */
    //根据异常信息抛出异常
    public ParameterException(String errorMessage){
        super(errorMessage);
        this.message = errorMessage;
        this.errorCode = ApiConstant.ERROR_CODE;
    }

    public ParameterException(Integer errorCode,String errorMessage){
        super(errorMessage);
        this.errorCode = errorCode;
    }


}
